import router from '@/router'
// 获取环境变量中的子应用entry
const { VUE_APP_MICRO_ENTRY } = process.env
const getActiveRule = (hash) => (location) => location.hash.startsWith(hash)
const origin = location.origin
const apps = [
  /**
  * name: 微应用名称 - 具有唯一性
  * entry: 微应用入口 - 通过该地址加载微应用
  * container: 微应用挂载节点 - 微应用加载完成后将挂载在该节点上
  * activeRule: 微应用触发的路由规则 - 触发路由规则后将加载该微应用
  */
  {
    name: "tigerlair",
    title: '虎啸系统',
    desc: 'TigerLair(Tiger Lair) - 虎啸系统',
    entry: origin + "/df3s/tigerlair/app/micro-app.html",
    activeRule: getActiveRule("#/tigerlair"),
    props: {
      router: router
    },
    container: "#apps"
  },
  {
    name: "dtools",
    title: '小工具集',
    desc: 'DTools(Dog Tools) - 小工具集',
    entry: origin + "/df3s/dtools/app/micro-app.html",
    activeRule: getActiveRule("#/dtools"),
    props: {
      router: router
    },
    container: "#apps"
  },
  {
    name: "dmapt",
    title: '地图工具',
    desc: 'DMapT(Dog Map Tools) - 狗狗地图工具',
    entry: origin + "/df3s/dmapt/app/micro-app.html",
    activeRule: getActiveRule("#/dmapt"),
    props: {
      router: router
    },
    container: "#apps"
  },
  {
    name: "dpad",
    title: '便笺系统',
    desc: 'DPad(Dog Pad) - 便笺系统',
    entry: origin + "/dwas/dpad/app/micro-app.html",
    activeRule: getActiveRule("#/dpad"),
    props: {
      router: router
    },
    container: "#apps"
  },
  {
    name: "dmusday",
    title: '音乐节',
    desc: 'DMusDay(Dog Music Day) - 音乐节',
    entry: origin + "/dwas/dmusday/app/micro-app.html",
    activeRule: getActiveRule("#/dmusday"),
    props: {
      router: router
    },
    container: "#apps"
  },
  {
    name: "dblog",
    title: '轻博客',
    desc: 'DBlog(Dog Blog) - 轻博客',
    entry: origin + "/dwas/dblog/app/micro-app.html",
    activeRule: getActiveRule("#/dblog"),
    props: {
      router: router
    },
    container: "#apps",
    isShow: false
  }
];

if (/daelui.cn/.test(location.href)) {
  apps.push({
    name: "dchat",
    title: '狗聊',
    desc: 'DChat(Dog Chat) - 狗聊',
    entry: origin + "/dwas/dchat/app/micro-app.html",
    activeRule: getActiveRule("#/dchat"),
    props: {
      router: router
    },
    container: "#apps"
  })
}

export default apps;

